package com.king.juc.shared.safe;

/**
 * @author king
 * @date 2020/10/28 15:44
 */
public class ThreadSafeDemo {
    static final int THREAD_NUMBER = 2;
    static final int LOOP_NUMBER = 200;

    public static void main(String[] args) {
//        ThreadUnSafe test = new ThreadUnSafe();
//        ThreadSafe test = new ThreadSafe();
        ThreadSafe test = new ThreadSafeSub();
        for (int i = 0; i < THREAD_NUMBER; i++) {
            new Thread(() -> {
                test.method1(LOOP_NUMBER);
            }, "Thread" + (i + 1)).start();
        }
    }
}
